import React, { Component } from 'react'
import store from './store'
export default class App extends Component {
  componentDidMount () {
    fetch('http://121.89.205.189/api/pro/list')
      .then(res => res.json())
      .then(res => {
        console.log(res)
        store.dispatch({
          type: 'UPDATE_PRO_LIST', 
          payload: res.data
        }); 
      })
  }
  render() {
    return (
      <div>
        {
          store.getState().proList.map(item => {
          return <p key={ item.proid }>{ item.proname }</p>
          })
        }
      </div>
    )
  }
}
